package team.you.change.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import team.you.change.util.Result;
import team.you.change.pojo.Room;
import team.you.change.service.RoomService;

@Controller
@RequestMapping("/room")
public class RoomController {
    @Autowired
    private RoomService roomService;

    @RequestMapping("/getAllRooms")
    @ResponseBody
    private Result getAllRooms(Integer page, Integer limit)
    {
        return roomService.getAllRooms(page,limit);
    }
    @RequestMapping("/del")
    @ResponseBody
    private Result del(String id)
    {
        return roomService.del(id);
    }
    @RequestMapping("/delete")
    @ResponseBody
    private Result delete(String[] ids)
    {
        return roomService.delete(ids);
    }
    @RequestMapping("/update")
    @ResponseBody
    private Result update(Room room)
    {
        return roomService.update(room);
    }
    @RequestMapping("/add")
    @ResponseBody
    private Result add(Room room){
        return roomService.add(room);
    }
    @RequestMapping("/selectByLike")
    @ResponseBody
    private Result selectByLike(String value,Integer type,Integer time, Integer state,Integer page,Integer limit) {
        return roomService.selectByLike(value, type, time, state, page, limit);
    }
    @RequestMapping("/selCode")
    @ResponseBody
    private Result selCode(String code){
        return roomService.selCode(code);
    }
    @RequestMapping("/state")
    @ResponseBody
    private Result state(String id, Integer value, String field){
        return roomService.state(id, value, field);
    }
    @RequestMapping("/getRoomOption")
    @ResponseBody
    private Result getRoomOption(String classId){
        return roomService.getRoomOption(classId);
    }
}
